<?php

namespace GuanChanghu\Enum;

use Spatie\Enum\Laravel\Enum;

/**
 * Class BaseEnum
 * @package GuanChanghu\Enum
 */
abstract class BaseEnum extends Enum
{
    /**
     * @param int|string $value
     * @return string
     */
    public static function getLabel(int|string $value): string
    {
        return static::from($value)->label;
    }

    /**
     * @return array
     */
    public static function options(): array
    {
        return array_map(
            fn(int|string $key, string $value): array => ['value' => $key, 'label' => $value],
            static::toArray()
        );
    }
}